import cv2
def get_distance():
    import cv2

    target_rgb = cv2.imread(r".\big.png")
    target_gray = cv2.cvtColor(target_rgb, cv2.COLOR_BGR2GRAY)
    template_rgb = cv2.imread(r".\small.png", 0)
    res = cv2.matchTemplate(target_gray, template_rgb, cv2.TM_CCORR_NORMED)
    value = cv2.minMaxLoc(res)
    value = value[2][0]
    print(f"应移动距离：{278 * value / 360}")
    return int(278 * value / 360)
if __name__ == "__main__":
    print(get_distance())